package dateformat;


import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateFormat {

    public DateFormat() {
    }

    public static void main(String[] args) throws ParseException {

        SimpleDateFormat simpleDateFormat = new SimpleDateFormat();
        String format = simpleDateFormat.format(new Date());
        System.out.println(format);

        String toPattern = simpleDateFormat.toPattern();
        System.out.println(toPattern);

        String format1 = simpleDateFormat.format(new Date());
        System.out.println(format1);

        SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String format2 = simpleDateFormat1.format(new Date());
        System.out.println(format2);

        String s = "2019-08-27";
        SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("yyyy-mm-dd");
        Date parse = simpleDateFormat2.parse(s);
        System.out.println(parse);
    }
}
